Skip to content

fix(query): prefer proven-empty outer join build side - #20220

Draft
dantengsky wants to merge 1 commit into
databendlabs:mainfrom
dantengsky:fix/outer-join-empty-cardinality-memo
Draft

fix(query): prefer proven-empty outer join build side#20220
dantengsky wants to merge 1 commit into
databendlabs:mainfrom
dantengsky:fix/outer-join-empty-cardinality-memo

Conversation

@dantengsky

@dantengsky dantengsky commented Jul 29, 2026

Copy link
Copy Markdown
Member

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

  • Preserve whether a zero cardinality is proven or only estimated through selectivity, filter, scan, and join statistics.
  • When both sides of a LEFT/RIGHT OUTER JOIN estimate to zero, prefer the proven-empty input as the hash-build side.
  • Add SQL-driven positive and negative optimizer golden coverage with complete raw and optimized plans.

This avoids blocking hash-build work on an expensive input when the other input is known to be empty. Non-zero estimates, two estimated zeros, and two proven zeros retain the existing commute behavior.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Validation:

  • PROTOC_INCLUDE=/usr/include cargo test -p databend-common-sql --lib (84 passed)
  • PROTOC_INCLUDE=/usr/include cargo test -p databend-common-sql --test it (84 passed)
  • PROTOC_INCLUDE=/usr/include cargo clippy -p databend-common-sql --all-targets -- -D warnings
  • cargo fmt --all -- --check

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

No migration, configuration change, or rollout action is required.


This change is Reviewable

@github-actions github-actions Bot added the pr-bugfix this PR patches a bug in codebase label Jul 29, 2026
@dantengsky
dantengsky force-pushed the fix/outer-join-empty-cardinality-memo branch from 956e4f9 to 6f93a92 Compare July 29, 2026 00:43
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

🤖 CI Job Analysis

Workflow: 30412780400

📊 Summary

  • Total Jobs: 89
  • Failed Jobs: 2
  • Retryable: 0
  • Code Issues: 2

NO RETRY NEEDED

All failures appear to be code/test issues requiring manual fixes.

🔍 Job Details

  • linux / sqllogic / standalone (standalone, 2c, http): Not retryable (Code/Test)
  • linux / sqllogic / standalone (standalone, 2c, hybrid): Not retryable (Code/Test)

🤖 About

Automated analysis using job annotations to distinguish infrastructure issues (auto-retried) from code/test issues (manual fixes needed).

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 956e4f95e8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dantengsky dantengsky added C-improvement Category: improvement and removed pr-bugfix this PR patches a bug in codebase labels Jul 29, 2026
@dantengsky
dantengsky force-pushed the fix/outer-join-empty-cardinality-memo branch from 6f93a92 to 38ef8a8 Compare July 29, 2026 00:59
@github-actions github-actions Bot added the pr-bugfix this PR patches a bug in codebase label Jul 29, 2026
@dantengsky
dantengsky marked this pull request as draft July 29, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-improvement Category: improvement pr-bugfix this PR patches a bug in codebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant